#include <iostream>  
#include <map>  
#include <vector>  
#include <algorithm>  
#include <utility>

using namespace std;
typedef pair<string , int> p;

bool cmp_value(const p & x ,const p & y ){
	return x.second > y.second;
}

int main(){
	map<string,int> mp;
	mp["a"] = 3;
	mp["c"] = 7;
	mp["b"] = 4;
	mp.insert(make_pair("d",10));
	mp.insert(make_pair("e",8));
	
	vector<p> v(mp.begin(),mp.end());
	sort(v.begin(),v.end(),cmp_value);
	vector<pair<string , int> >::iterator it = v.begin();
	for(;it != v.end();++it){
		cout<<it->first<<" "<<it->second<<endl;
	}
	return 0;
}



